package com.lc.user.express.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lc.user.express.R;
import com.lc.user.express.app.AppContext;
import com.lc.user.express.model.CityModel;

import java.util.List;

/**
 * Created by Administrator on 2016/3/3.
 */
public class CityAdapter extends BaseListAdapter<CityModel> {
    public CityAdapter(Context context, List<CityModel> data) {
        super(context, data);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = new ViewHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_city_content_list, null);
            AppContext.ScaleScreenHelper.loadView((ViewGroup) convertView);
            viewHolder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
            convertView.setTag(viewHolder);
        }

        setContentView(convertView, position);
        return convertView;
    }

    private void setContentView(View arg1, int arg0) {

        // TODO Auto-generated method stub
        ViewHolder viewHolder = (ViewHolder) arg1.getTag();
        viewHolder.tv_content.setText(data.get(arg0).getCity());
    }

    private static final class ViewHolder {
        TextView tv_content;
    }
}




